package org.usfirst.frc;
import edu.wpi.first.wpilibj.*;
import java.util.Timer;
import java.util.TimerTask;

public class CompressorThread implements Runnable
{
    private Relay relay;
    private Timer timer;
    private TimerTask timerTask;
    private Compressor comp;
    
    /**
    Creates a new thread for the compressor module
    **/
    public CompressorThread()
    {
    timerTask = new TimerTask()
    {
    public void run() 
        {
        if(comp.getPressureSwitchValue() == true)
            comp.stop();
        else
            comp.start();
        }
    }; 
    timer.schedule(timerTask, 0, 15000); 
    new Thread(this).start();
    }

    public void run() 
	{
    relay = new Relay(4,1);
    relay.setDirection(Relay.Direction.kForward);
    while(true)
        {
        relay.set(Relay.Value.kOn);
        }
    }
}
